package com.xm.servlet.background.commodity;

import com.xm.service.background.CommoditySpecificationTypeService;
import lombok.SneakyThrows;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 新增规格类别
 * @author 康文程
 * @date 2024-1-17
 */
@WebServlet("/background/insert/commodity/type/specification")
public class InsertCommoditySpecificationTypeServlet extends HttpServlet {
    private final CommoditySpecificationTypeService service = new CommoditySpecificationTypeService();

    @SneakyThrows
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String specificationTypeName = req.getParameter("specificationTypeName");
        System.out.println(specificationTypeName);
        resp.getWriter().println(service.insertCommoditySpecificationType(specificationTypeName));
    }
}
